function MainCtrl() {
	this.daterange = {startDate: null, endDate: null}
}

function LogCtrl($scope,$http){
	$scope.logForm={
		startDate:'2016-01-03',
		endDate:'2016-01-05'
	};
	$scope.data={};
	$scope.params="";
	$scope.pager = {
		totalItems : 94,
		currentPage : 2,
		maxSize : 7
	};
	$scope.setPage = function (pageNo) {
	    $scope.currentPage = pageNo;
	  };

	$scope.pageChanged = function() {
		console.log('Page changed to: ' + $scope.pager.currentPage);
	};

	$scope.getData = function(arg){
		var url = '/getdata/data.json';
		if (arg) {
			url = '/getdata/'+arg;
			var params ="";
			params = $scope.logForm.startDate ? params + "&startDate="+$scope.logForm.startDate : params;
			params = $scope.logForm.endDate ? params + "&endDate="+$scope.logForm.endDate : params;
			params = $scope.logForm.logStatus ? params + "&logStatus="+$scope.logForm.logStatus : params;
			params = $scope.logForm.keyword ? params + "&keyword="+$scope.logForm.keyword : params;
			if(params) url = url+"?"+params;
		}
		$http.get(url).success(
			function(data){
				$scope.data = data;	

			});

	}
	$scope.getData();

}
function LogDetial($scope, $stateParams){
	$scope.logId = $stateParams.id
	console.log($scope.logId);
}

angular
    .module('orgAdmin')
    .controller('MainCtrl', MainCtrl)
    .controller('LogCtrl', LogCtrl)
    .controller('LogDetial', LogDetial);